package vip.xiaonuo.biz.modular.article.controller;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import vip.xiaonuo.biz.modular.article.entity.BizArticle;
import vip.xiaonuo.biz.modular.article.param.BizArticleIdParam;
import vip.xiaonuo.biz.modular.article.param.BizArticlePageParam;
import vip.xiaonuo.biz.modular.article.service.BizArticleService;
import vip.xiaonuo.common.pojo.CommonResult;

import javax.annotation.Resource;
import java.util.List;

@RequestMapping("/client/article")
@RestController
public class ClientArticleController {

    @Resource
    private BizArticleService service;

    @GetMapping("/page")
    public CommonResult<Page<BizArticle>> page(BizArticlePageParam pageParam){
        return CommonResult.data(service.pageForC(pageParam));
    }

    @GetMapping("/detail")
    public CommonResult<BizArticle> detail(BizArticleIdParam idParam){
        return CommonResult.data(service.detail(idParam));
    }

    @GetMapping("/getLatestArticle")
    public CommonResult<List<BizArticle>> getLatestArticle(){
        return CommonResult.data(service.getLatestArticle());
    }

}
